package op.valorantwikibackend.controller;

import op.valorantwikibackend.model.Weapon;
import op.valorantwikibackend.repository.WeaponRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/weapons")
public class WeaponController {
    @Autowired
    private WeaponRepository weaponRepository;

    @GetMapping
    public List<Weapon> getAllWeapons() {
        return weaponRepository.findAll();
    }

    @PostMapping
    public Weapon createWeapon(@RequestBody Weapon weapon) {
        return weaponRepository.save(weapon);
    }
}